package cn.iocoder.yudao.module.product.utils;

import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.product.service.brand.ProductBrandService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @author 徐利民
 * @date 2024/1/2 18:14
 */

@Component
public class UserUtils {
    @Resource
    private AdminUserApi adminUserApi;


    public AdminUserRespDTO getUser() {
        //获取当前用户
        LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
        if (Objects.nonNull(loginUser)) {
            return adminUserApi.getUser(loginUser.getId());
        }
        return null;
    }
}
